package base.action.lib;

import javax.servlet.http.HttpServletRequest;

public class HttpRequestFactory {

	private static final ThreadLocal<HttpServletRequest> localrequest = new ThreadLocal<HttpServletRequest>();

	/**
	 * 取出 放入ThreadLocal中的request
	 */
	public static HttpServletRequest getRequest() {
		HttpServletRequest request = localrequest.get();
		return request;
	}
	
	/**
	 * 根据request 放入ThreadLocal中
	 * @param _httpRequest
	 */
	public static void setRequest(HttpServletRequest _httpRequest){
		if(_httpRequest != null) {
			localrequest.set(_httpRequest);
		}
	}
}
